package tools;

import java.util.Random;

public class Tool {
	public static boolean checkEmailFormat(String email){
		String emailRegex= "^[\\w-_\\.+]*[\\w-_\\.]\\@([\\w]+\\.)+[\\w]+[\\w]$";
		 boolean check=email.matches(emailRegex);
		 if(check){
			 return true;
		 }else{
			 return false;
		 }
	}
	
	public static boolean checkPhoneNumber(int phone){
		if(phone>99999999 && phone<1000000000){
			return true;
		}else{
			return false;
		}
	}
	
	public static String setRandomPassword(){
		String alphabet = "1234567890abcdefghijklmnoprstuwyzABCDEFGHIJKLMNOPRSTUWXYZQ";
		   Random r = new Random();
		   String newPassword = ""; 
		   for (int i = 0; i < 10; i++) {
			   newPassword += alphabet.charAt(r.nextInt(alphabet.length()));
		   }
		   return newPassword;
	}
}
